home *** CD-ROM | disk | FTP | other *** search
/ MacHome 1999 Game / Image.bin / Role Playing and Strategy / Starbound II.hqx / Starbound II / AI agents / Gypsum.rsrc / ss$t_133 < prev    next >
Encoding:
Text File  |  1998-05-14  |  644 b   |  24 lines

  1. situation planetary_defense_system
  2. vars
  3.    num : integer;
  4.    i : integer;
  5.    best : integer;
  6.    success : boolean;
  7.  
  8. begin
  9.    // First see if the ships in orbit are an enemy race
  10.    if (Orbit_owner(This_planet()) <> Planet_race(This_planet())) then
  11.       begin
  12.          // Find the ship with the weakest shields
  13.          num := Num_bombarding_ships();
  14.          i := 1;
  15.          best := 0;
  16.          while (i < num) do
  17.             begin
  18.                if (Bombarding_shield(i) < Bombarding_shield(best)) then
  19.                   best := i;
  20.                i := i + 1;
  21.             end;
  22.          success := Fire_planetary_defense(best);
  23.       end;
  24. end;